import {
	defineStore
} from 'pinia'
import {
	computed,
	ref,
	watch
} from 'vue'
const themeStore = defineStore('theme', () => {
	console.log('创建数据状态缓存成功')
	const theme = ref('light');
	const changeTheme = (type) => {
		if (type) {
			theme.value = 'dark'
		} else {
			theme.value = 'light'
		}

	}
	const themeClass = ref('')
	watch(theme,(val) => {
		const bgClass = theme.value + '-bg'
		const colorClass = theme.value + '-color'
		themeClass.value = bgClass + ' ' + colorClass
	})
	return {
		theme,
		changeTheme,
		themeClass
	}
})

export default themeStore